<template>
  <div class="home">
    <!-- 表格 -->
    <div class="table_box">
      <el-table
        border
        height="295"
        v-loading="loading"
        :header-cell-style="tableHeader"
        ref="multipleTable"
        :data="tableInfo"
        tooltip-effect="dark"
        style="width: 100%;">
        <el-table-column
          width="160"
          prop="modifyTime"
          label="修改时间">
          <template slot-scope="scope">
            <p style="text-align: left">{{ formatTime(scope.row.modifyTime) }}</p>
          </template>
        </el-table-column>
        <el-table-column
          width="150"
          prop="productName"
          label="商品">
          <template slot-scope="scope">
            <p>{{ scope.row.productName ? scope.row.productName : '——' }}</p>
          </template>
        </el-table-column>

        <el-table-column
          prop="factNumbers"
          width="120"
          label="实收商品数量">
        </el-table-column>

        <el-table-column
          prop="factReturnNumber"
          width="120"
          label="实收空桶数量">
        </el-table-column>

        <el-table-column
          prop="numbers"
          label="商品数量">
        </el-table-column>

        <el-table-column
          prop="returnNumber"
          label="空桶数量">
        </el-table-column>

      </el-table>
    </div>
  </div>
</template>

<script>

import commons from "@/utils/common";
import {getRecycleOrderDetail} from "@/api/basic/warehouse/recycleOrder";

export default {
  props: ['orderId'],
  data() {
    return {
      loading: false,
      tableInfo: [],
    }
  },
  mounted() {
    this.getTableInfo();
  },
  methods: {
    // 获取列表信息
    getTableInfo() {
      let that = this;
      that.loading = true;
      getRecycleOrderDetail(that.orderId).then(res => {
        that.tableInfo = res ? res : [];
        that.loading = false;
      }).catch((e) => {
        that.loading = false;
      });
    },

    formatTime(time) {
      return commons.formatTime(time)
    },

    // 设置table标题居中
    tableHeader({row, column, rowIndex, columnIndex}) {
      return 'background:#F0F2F5;color:#111;padding:10px 0;font-size:14px;font-weight:600'
    },
  },
  watch: {
    orderId(newD, oldD) {
      this.getTableInfo()
    }
  }
}
</script>

<style scoped>
.home {
  padding-left: 20px;
}
</style>
